import { check } from 'meteor/check';
import { Apps } from '/imports/models/Apps';
import { ChannelApps } from '/imports/models/ChannelApps';

Meteor.methods({
  installApp(options) {
    check(options.appId, String);
    check(options.channelId, String);
    return ChannelApps.insert({
      appId: options.appId,
      channelId: options.channelId
    });
  },

  uninstallApp(options) {
    check(options.appId, String);
    check(options.channelId, String);
    return ChannelApps.remove({
      appId: options.appId,
      channelId: options.channelId
    });
  }
});